#!/bin/bash
# builds debian package for usagetracker
# NOTE!!:  Need to add postinst script to create /var/log/wtmp, /var/log/btmp and desktop icon.

PACKAGENAME="usagetracker_0.2_all.deb"
echo "buildpackage.sh: building package...:", $PACKAGENAME

# Freshly create the filesystem rooted at dist
rm -rf dist

mkdir -p dist/var/log/usagetracker
mkdir -p dist/etc
mkdir -p dist/etc/cron.hourly
mkdir -p dist/usr/share/doc/usagetracker
cp -rf DEBIAN dist

cp -vf usagetracker dist/etc/cron.hourly
chmod +x dist/etc/cron.hourly/usagetracker
cp -vf usagetracker.conf dist/etc/
cp -vf README.txt dist/usr/share/doc/usagetracker
#cp -vf desktopIcon.txt /home/guru/Desktop/Computer\ Usage
dpkg -b dist $PACKAGENAME

# Clean up dist
rm -rf dist

echo
echo "buildpackage.sh: package built:", $PACKAGENAME
